﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CloudPms.Common.CacheProvider;
using CloudPms.Common.Utils;
using CloudPms.Domain.Repository;
using CloudPms.Entity.Entities;
using CloudPms.Logic.Interface;

namespace CloudPms.Logic.Business
{
    /// <summary>
    /// 订单处理
    /// <para>--------------------------</para>
    /// <para>@Author: cnalexi@gmail.com</para> 
    /// <para>@Create: 2012/9/29</para>  
    /// </summary>
    public class OrderService : IOrderService
    {
        #region ☆ -------- 入住操作 -------- ☆

        /// <summary>
        /// 入住
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="otherInfo">其他信息</param>
        /// <param name="face">头像</param>
        /// <param name="bills">账单</param>
        /// <param name="wares">商品</param>
        /// <param name="coupons">优惠券</param>
        /// <returns>订单编号</returns>
        public string CheckIn(Order order,OrderOtherInfo otherInfo,OrderFace face,IList<Bill> bills, IList<OrderWares> wares,IList<OrderCoupon> coupons)
        {

            if (order.Status == EnumHelper.GetCode(OrderStatus.R))
            {
                ReserveCheckIn(order,otherInfo,face,bills,wares,coupons);
            }
            return string.Empty;
        }

        /// <summary>
        /// 预订入住
        /// </summary>
        private void ReserveCheckIn(Order order, OrderOtherInfo otherInfo, OrderFace face, IList<Bill> bills, IList<OrderWares> wares, IList<OrderCoupon> coupons)
        {
            
        }

        /// <summary>
        /// 组装重新入住订单
        /// </summary>
        /// <param name="hotelId">酒店编号</param>
        /// <param name="orderId">重新入住的订单</param>
        public Order BuildReCheckIn(string hotelId, string orderId)
        {
            return null;
        }

        #endregion

        #region ☆ -------- 修改定单 -------- ☆

        /// <summary>
        /// 修改订单
        /// </summary>
        /// <param name="order"></param>
        public void EditOrder(Order order)
        {
            //
        }

        /// <summary>
        /// 添加随行
        /// </summary>
        /// <param name="accompany">随行人</param>
        /// <param name="otherInfo">其他信息</param>
        /// <param name="face">头像</param>
        /// <returns>随行ID</returns>
        public string AddAccompany(OrderAccompany accompany, OrderOtherInfo otherInfo, OrderFace face)
        {
            //
            return null;
        }

        public void EditOtherInfo(OrderOtherInfo otherInfo)
        {
            //
        }

        public void EditGuestFace(OrderFace face)
        {
        }

        public void EditOrderMemo(string hotelId, string orderId, string memo)
        {

        }

        public void ChangeRoom(Order order,Room originRoom, Room newRoom, bool isFreeUpdate, string reason)
        {

        }

        public void EditAccompany(OrderAccompany accompany)
        {
            //需在ORDER单加一个字段叫随行 比较方便处理查找的问题。
        }

        #endregion

        #region ☆ -------- 退房操作 -------- ☆

        /// <summary>
        /// 组装退房订单
        /// </summary>
        /// <param name="order"></param>
        /// <returns>退房订单</returns>
        public Order BuildCheckOut(Order order)
        {
            return null;
        }

        #endregion

        #region ☆ -------- 团联管理 -------- ☆

        /// <summary>
        /// 加入团队
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="groupId">团队编号</param>
        /// <returns></returns>
        public void JoinGroup(Order order, string groupId)
        {
        }

        /// <summary>
        /// 离开团队
        /// </summary>
        /// <param name="order"></param>
        /// <param name="groupId"></param>
        public void LeaveGroup(Order order, string groupId)
        {
        }

        /// <summary>
        /// 加入关联订单
        /// </summary>
        /// <param name="origin"></param>
        /// <param name="destin"></param>
        public void JoinRelate(Order origin, Order destin)
        {

        }

        /// <summary>
        /// 离开关联订单
        /// </summary>
        /// <param name="leaver"></param>
        public void RemoveRelate(Order leaver)
        {
        }

        /// <summary>
        /// 设置主单
        /// </summary>
        /// <param name="order"></param>
        public void SetMasterOrder(Order order)
        {
            //
        }

        #endregion

        #region ☆ -------- 查询操作 -------- ☆

        /// <summary>
        /// 条件搜索订单
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public IList<Order> SearchOrders(SearchOrderParam param)
        {
            return null;
        }

        /// <summary>
        /// 查找历史订单
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public IList<Order> SearchHistoryOrders(SearchOrderParam param)
        {
            return null;
        }

        /// <summary>
        /// 模糊搜索3个月内的的退房和noshow单，以及有效订单住单 姓名，
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public IList<Order> FuzzySearchOrders(string key)
        {
            //模糊搜索条件 姓名，订单编号，协议名，等等


            return null;
        }

        #endregion

        #region protected private method

        #endregion
    }
}
